"""
在初始化方法内部定义属性升级版
"""


class Test:
    def __init__(self, name):
        self.name = name

    def eat(self):
        print('%s爱吃鱼' % self.name)


ts = Test('tom')
print(ts.name)

ls_ts = Test('city')
ls_ts.eat()
